import { defineStore } from 'pinia'
import { store } from '@/stores'
import type { userType } from './types'

export const useUserStore = defineStore({
  id: 'pure-user',
  state: (): userType => ({
    // 用户名
    username: 'difai'
  }),
  actions: {
    /** 存储用户名 */
    SET_USERNAME(username: string) {
      this.username = username
    }
  }
})

export function useUserStoreHook() {
  return useUserStore(store)
}
